import axios from '@/http/axios'
export default{
    namespaced:true,
    state:{
        custermerInfo:[],
        custermerOrder:[],
        custermerAddress:[]
    },
    getters:{},
    mutations:{
        setCustermerInfo(state,data){
            state.custermerInfo=data
        },
        setCustermerOrder(state,data){
			state.custermerOrder = data
        },
        setCustermerAddress(state,data){
            state.custermerAddress=data
        }
    },
    actions:{
        async toLoadCustermerAddress(context,params){
            let res = await axios.get('/address/findByCustomerId?id='+params)
            context.commit('setCustermerAddress',res.data.data)
        },
        async toLoadCustermerOrder(context,params){
			let res = await axios.post('/order/queryPage',params)
			// console.log(res.data.data)
			context.commit('setCustermerOrder',res.data.data)
		},
        async toLoadCustermerInfo(context,params){
            let res = await axios.get('/customer/findCustomerById?id='+params)
            context.commit('setCustermerInfo',res.data.data)
        }
    }
}